package com.sophialex.health.record.ui.account;

import java.util.List;

import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.part.DrillDownAdapter;

import com.sophialex.health.person.vo.SoapService;
import com.sophialex.health.record.Messages;
import com.sophialex.health.record.common.utils.ImageUtil;
import com.sophialex.health.system.frame.resource.RcpResourceManager;


public class PersonAccountComposite extends Composite {


	private List<SoapService> soapServiceList;
    
	private TreeViewer returnView;
	
    private String name;

    private CLabel nameLabel;




	/**
	 * Create the composite.
	 * 
	 * @param parent
	 * @param style
	 */
	public PersonAccountComposite(Composite parent, int style,TreeViewer viewer) {
		super(parent, style);
		setBackground(RcpResourceManager.getColor(244, 244, 247));
		setLayout(new FormLayout());
		nameLabel = new CLabel(this, SWT.NONE);
		{
			FormData formData_2 = new FormData();
			formData_2.top = new FormAttachment(0, 0);
			formData_2.left = new FormAttachment(0, 0);
			formData_2.right = new FormAttachment(100, 0);
			formData_2.bottom = new FormAttachment(0, 30);
			nameLabel.setLayoutData(formData_2);
		}
		nameLabel.setImage(ImageUtil.title);
		nameLabel.setBackground(ImageUtil.headBj);

		Composite composite = new Composite(this, SWT.NONE);
		composite.setLayout(new FillLayout(SWT.HORIZONTAL));
		{
			FormData formData_1 = new FormData();
			formData_1.left = new FormAttachment(0);
			formData_1.right = new FormAttachment(100);
			formData_1.top = new FormAttachment(nameLabel, 0, SWT.BOTTOM);
			formData_1.bottom = new FormAttachment(100);
			composite.setLayoutData(formData_1);
		}
		
		viewer = new TreeViewer(composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
		DrillDownAdapter drillDownAdapter = new DrillDownAdapter(viewer);
        this.returnView = viewer;
//		viewer.setContentProvider(new ViewContentProvider());
//		viewer.setLabelProvider(new ViewLabelProvider());
////		viewer.setInput(getViewSite());
//		viewer.expandToLevel(2);
		
		
	}

	

	private void deal() {
		try {
//			Tmessageinfo info = (Tmessageinfo) lktable.getSelection();
//			Task deal = ProcessContext.getInstrance().getDeal(info.getFtype());
//			if (deal == null) {
//				throw new Exception(Messages.MessageLogComposite_14 + info.getFtype());
//			}
//			if (deal.deal(info)) {
//				if (info.getFstate().intValue() == ProcessType.STATE_NOT_READ) {
//					info.setFstate(ProcessType.STATE_READ.longValue());
//					ProcessContext.server.saveOrUpdate(info);
//					lktable.redraw();
//				}
//			}
		} catch (Exception ee) {
			ee.printStackTrace();
		}
	}
	public TreeViewer getReturnView() {
		return returnView;
	}
	public CLabel getNameLabel() {
		return nameLabel;
	}



}
